package com.cat.asmandroidtrace

import android.content.ActivityNotFoundException
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*


class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        downLoadManagerSetting.setOnClickListener {
            try {
                //Open the specific App Info page:
                val intent = Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
                intent.data = Uri.parse("package:" + "com.android.providers.downloads")
                startActivity(intent)

            } catch (e: ActivityNotFoundException) {
                //Open the generic Apps page:
                val intent = Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS)
                startActivity(intent)
            }

        }

        scrollingPage.setOnClickListener {
            startActivity(Intent(this,ScrollingActivity::class.java))
        }
    }
}
